
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 优惠券
    ticketFlag: true,
    businessId: "",
    ticketList: [],
    ticketId: 0,
  },


  // 优惠券
  chooseTicket: function () {
    var that = this;
    var uid = this.data.uid;
    var businessId = this.data.businessId;
    var ticketList = this.data.ticketList;
    wx.request({
      url: baseJs.api + baseJs.encryUrl("method=GetCanUseCoupon&UID=" + uid + "&SJID=" + businessId),
      success: function (res) {
        console.log("method=GetCanUseCoupon&UID=" + uid + "&SJID=" + businessId);
        var json = JSON.parse(baseJs.decryUrl(res.data));
        console.log(json);
        if (json.ResultData.length > 0) {
          that.setData({
            ticketList: json.ResultData,
            ticketFlag: false,
          })
        } else {
          wx.showModal({
            title: '提示',
            content: "您没有可使用的易易红包!",
            showCancel: false
          })
        }
      }
    })
  },

})